From 9fd95ea7606385e09ddd03c23b44e13c176b1130 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Thu, 11 Aug 2005 18:59:47 +0000 Subject: [PATCH] Changed foo_extras to a format-specific-data chain --- Makefile | 242 ++++++++++++++++++++++++++--------------------------- an1.c | 59 ++++++++----- defs.h | 37 ++++++-- formspec.c | 65 ++++++++++++++ gpx.c | 18 +++- html.c | 11 ++- palmdoc.c | 12 ++- route.c | 7 +- text.c | 10 ++- waypt.c | 14 +--- xmltag.c | 126 ++++++++++++++++++++++++++++ 11 files changed, 421 insertions(+), 180 deletions(-) create mode 100644 formspec.c create mode 100644 xmltag.c diff --git a/Makefile b/Makefile index 1b1738eca..89e346d2e 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,8 @@ COLDSYNC=coldsync/util.o coldsync/pdb.o SHAPE=shapelib/shpopen.o shapelib/dbfopen.o LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \ - csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o uuid.o \ + csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o \ + uuid.o formspec.o xmltag.o \ $(COLDSYNC) $(GARMIN) $(JEEPS) $(SHAPE) $(FMTS) $(FILTERS) OBJS = main.o $(LIBOBJS) @@ -140,20 +141,21 @@ msvc-build: LINK.EXE /NOLOGO @objs.lst ./msvc/expat/libexpat.lib /out:gpsbabel.exe # Machine generated from here down. - an1.o: an1.c defs.h queue.h gbtypes.h an1sym.h arcdist.o: arcdist.c defs.h queue.h gbtypes.h grtcirc.h bcr.o: bcr.c defs.h queue.h gbtypes.h garmin_tables.h brauniger_iq.o: brauniger_iq.c defs.h queue.h gbtypes.h jeeps/gpsserial.h \ - jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gps.h jeeps/gpsport.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h cetus.o: cetus.c defs.h queue.h gbtypes.h coldsync/palm.h coldsync/pdb.h coastexp.o: coastexp.c defs.h queue.h gbtypes.h xmlgeneric.h uuid.h copilot.o: copilot.c defs.h queue.h gbtypes.h coldsync/palm.h \ coldsync/pdb.h +coto.o: coto.c defs.h queue.h gbtypes.h csv_util.h coldsync/palm.h \ + coldsync/pdb.h csv_util.o: csv_util.c defs.h queue.h gbtypes.h csv_util.h grtcirc.h \ strptime.h delgpl.o: delgpl.c defs.h queue.h gbtypes.h @@ -161,20 +163,21 @@ discard.o: discard.c defs.h queue.h gbtypes.h duplicate.o: duplicate.c defs.h queue.h gbtypes.h easygps.o: easygps.c defs.h queue.h gbtypes.h filter_vecs.o: filter_vecs.c defs.h queue.h gbtypes.h -garmin.o: garmin.c defs.h queue.h gbtypes.h jeeps/gps.h jeeps/../defs.h \ - jeeps/gpsport.h jeeps/gpsserial.h jeeps/gps.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h garmin_tables.h +formspec.o: formspec.c defs.h queue.h gbtypes.h +garmin.o: garmin.c defs.h queue.h gbtypes.h jeeps/gps.h jeeps/gpsport.h \ + jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \ + jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \ + jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h \ + garmin_tables.h garmin_tables.o: garmin_tables.c garmin_tables.h gcdb.o: gcdb.c defs.h queue.h gbtypes.h coldsync/palm.h coldsync/pdb.h gdb.o: gdb.c defs.h queue.h gbtypes.h garmin_tables.h jeeps/gpsmath.h \ - jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gps.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ + jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ + jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h geo.o: geo.c defs.h queue.h gbtypes.h xmlgeneric.h geoniche.o: geoniche.c defs.h queue.h gbtypes.h coldsync/palm.h \ coldsync/pdb.h @@ -191,11 +194,10 @@ hiketech.o: hiketech.c defs.h queue.h gbtypes.h xmlgeneric.h holux.o: holux.c defs.h queue.h gbtypes.h holux.h hsa_ndv.o: hsa_ndv.c defs.h queue.h gbtypes.h html.o: html.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ - jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h igc.o: igc.c defs.h queue.h gbtypes.h internal_styles.o: internal_styles.c defs.h queue.h gbtypes.h kml.o: kml.c defs.h queue.h gbtypes.h xmlgeneric.h @@ -214,11 +216,11 @@ nmea.o: nmea.c defs.h queue.h gbtypes.h overlay.o: overlay.c defs.h queue.h gbtypes.h grtcirc.h ozi.o: ozi.c defs.h queue.h gbtypes.h csv_util.h palmdoc.o: palmdoc.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ - jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h coldsync/palm.h coldsync/pdb.h + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h \ + coldsync/palm.h coldsync/pdb.h pathaway.o: pathaway.c defs.h queue.h gbtypes.h coldsync/palm.h \ coldsync/pdb.h csv_util.h pcx.o: pcx.c defs.h queue.h gbtypes.h garmin_tables.h @@ -239,121 +241,119 @@ stackfilter.o: stackfilter.c defs.h queue.h gbtypes.h strptime.o: strptime.c strptime.h tef_xml.o: tef_xml.c defs.h queue.h gbtypes.h xmlgeneric.h text.o: text.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ - jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h tiger.o: tiger.c defs.h queue.h gbtypes.h csv_util.h tmpro.o: tmpro.c defs.h queue.h gbtypes.h csv_util.h tomtom.o: tomtom.c defs.h queue.h gbtypes.h tpg.o: tpg.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ - jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h trackfilter.o: trackfilter.c defs.h queue.h gbtypes.h strptime.h util.o: util.c defs.h queue.h gbtypes.h util_crc.o: util_crc.c uuid.o: uuid.c uuid.h vcf.o: vcf.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ - jeeps/../defs.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ - jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ - jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ - jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ - jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \ + jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h vecs.o: vecs.c defs.h queue.h gbtypes.h csv_util.h vitosmt.o: vitosmt.c defs.h queue.h gbtypes.h vmem.o: vmem.c defs.h queue.h gbtypes.h waypt.o: waypt.c defs.h queue.h gbtypes.h xcsv.o: xcsv.c defs.h queue.h gbtypes.h csv_util.h xmlgeneric.o: xmlgeneric.c defs.h queue.h gbtypes.h xmlgeneric.h +xmltag.o: xmltag.c defs.h queue.h gbtypes.h coldsync/pdb.o: coldsync/pdb.c coldsync/config.h coldsync/palm.h \ coldsync/pdb.h coldsync/util.o: coldsync/util.c coldsync/config.h coldsync/pconn/util.h \ coldsync/palm.h -jeeps/gpsapp.o: jeeps/gpsapp.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h -jeeps/gpscom.o: jeeps/gpscom.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h -jeeps/gpslibusb.o: jeeps/gpslibusb.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h -jeeps/gpsmath.o: jeeps/gpsmath.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/gpsdatum.h -jeeps/gpsmem.o: jeeps/gpsmem.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h -jeeps/gpsprot.o: jeeps/gpsprot.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h -jeeps/gpsread.o: jeeps/gpsread.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/gpsusbint.h -jeeps/gpsrqst.o: jeeps/gpsrqst.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h -jeeps/gpssend.o: jeeps/gpssend.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/gpsusbint.h -jeeps/gpsserial.o: jeeps/gpsserial.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h -jeeps/gpsusbread.o: jeeps/gpsusbread.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h \ +jeeps/gpsapp.o: jeeps/gpsapp.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h +jeeps/gpscom.o: jeeps/gpscom.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h +jeeps/gpslibusb.o: jeeps/gpslibusb.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/garminusb.h +jeeps/gpsmath.o: jeeps/gpsmath.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/gpsdatum.h +jeeps/gpsmem.o: jeeps/gpsmem.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/garminusb.h +jeeps/gpsprot.o: jeeps/gpsprot.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h +jeeps/gpsread.o: jeeps/gpsread.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/gpsusbint.h +jeeps/gpsrqst.o: jeeps/gpsrqst.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h +jeeps/gpssend.o: jeeps/gpssend.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/gpsusbint.h +jeeps/gpsserial.o: jeeps/gpsserial.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h jeeps/garminusb.h +jeeps/gpsusbread.o: jeeps/gpsusbread.c jeeps/gps.h defs.h queue.h \ + gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ + jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ + jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ + jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ + jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h \ jeeps/gpsusbint.h -jeeps/gpsusbsend.o: jeeps/gpsusbsend.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h \ +jeeps/gpsusbsend.o: jeeps/gpsusbsend.c jeeps/gps.h defs.h queue.h \ + gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h \ + jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ + jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h \ + jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ + jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h jeeps/garminusb.h \ jeeps/gpsusbint.h jeeps/gpsusbstub.o: jeeps/gpsusbstub.c -jeeps/gpsutil.o: jeeps/gpsutil.c jeeps/gps.h jeeps/../defs.h \ - jeeps/../queue.h jeeps/../gbtypes.h jeeps/gpsport.h jeeps/gpsserial.h \ - jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h \ - jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h \ - jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \ - jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h +jeeps/gpsutil.o: jeeps/gpsutil.c jeeps/gps.h defs.h queue.h gbtypes.h \ + jeeps/gpsport.h jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h \ + jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \ + jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h \ + jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h \ + jeeps/gpsnmeaget.h shapelib/dbfopen.o: shapelib/dbfopen.c shapelib/shapefil.h shapelib/shpopen.o: shapelib/shpopen.c shapelib/shapefil.h internal_styles.c: mkstyle.sh style/README.style style/arc.style style/csv.style style/custom.style style/dna.style style/fugawi.style style/gpsdrive.style style/gpsdrivetrack.style style/gpsman.style style/mapconverter.style style/mxf.style style/nima.style style/openoffice.style style/s_and_t.style style/saplus.style style/tabsep.style style/xmap.style style/xmapwpt.style diff --git a/an1.c b/an1.c index cb98a17a7..8f55c5745 100644 --- a/an1.c +++ b/an1.c @@ -195,7 +195,7 @@ typedef struct { } an1_symbol_record; typedef struct { - an1_base base; + format_specific_data fs; short magic; long unk1; long lon; @@ -226,7 +226,7 @@ typedef struct { } an1_waypoint_record; typedef struct { - an1_base base; + format_specific_data fs; short magic; long unk0; long lon; @@ -235,7 +235,7 @@ typedef struct { } an1_vertex_record; typedef struct { - an1_base base; + format_specific_data fs; short magic; short unk1; short serial; @@ -275,8 +275,9 @@ void Copy_AN1_Waypoint( void **vdwpt, void *vwpt ) { static an1_waypoint_record *Alloc_AN1_Waypoint( ) { an1_waypoint_record *result = NULL; result = (an1_waypoint_record *)xcalloc( sizeof(*result), 1 ); - result->base.copy = Copy_AN1_Waypoint; - result->base.destroy = Destroy_AN1_Waypoint; + result->fs.type = FS_AN1W; + result->fs.copy = Copy_AN1_Waypoint; + result->fs.destroy = Destroy_AN1_Waypoint; return result; } @@ -296,8 +297,9 @@ void Copy_AN1_Vertex( void **vdvert, void *vvert ) { static an1_vertex_record *Alloc_AN1_Vertex() { an1_vertex_record *result = NULL; result = (an1_vertex_record *)xcalloc( sizeof( *result), 1 ); - result->base.copy = Copy_AN1_Vertex; - result->base.destroy = Destroy_AN1_Vertex; + result->fs.type = FS_AN1V; + result->fs.copy = Copy_AN1_Vertex; + result->fs.destroy = Destroy_AN1_Vertex; return result; } @@ -320,8 +322,9 @@ void Copy_AN1_Line( void **vdline, void *vline ) { static an1_line_record *Alloc_AN1_Line( ) { an1_line_record *result = NULL; result = (an1_line_record *)xcalloc( sizeof(*result), 1 ); - result->base.copy = Copy_AN1_Line; - result->base.destroy = Destroy_AN1_Line; + result->fs.type = FS_AN1L; + result->fs.copy = Copy_AN1_Line; + result->fs.destroy = Destroy_AN1_Line; return result; } @@ -550,7 +553,7 @@ static void Read_AN1_Waypoints( FILE *f ) { unsigned long count = 0; unsigned long i = 0; an1_waypoint_record *rec = NULL; - waypoint *wpt_tmp; + waypoint *wpt_tmp; char *icon = NULL; ReadShort( f ); count = ReadLong( f ); @@ -566,8 +569,8 @@ static void Read_AN1_Waypoints( FILE *f ) { if (FindIconByGuid(&rec->guid, &icon)) { wpt_tmp->icon_descr = icon; } - - wpt_tmp->an1_extras = (an1_base *)(void *)rec; + + fs_chain_add( &(wpt_tmp->fs), (format_specific_data *)rec); rec = NULL; waypt_add( wpt_tmp ); } @@ -578,9 +581,12 @@ Write_One_AN1_Waypoint( const waypoint *wpt ) { an1_waypoint_record *rec; int local; + format_specific_data *fs = NULL; + + fs = fs_chain_find( wpt->fs, FS_AN1W ); - if ( wpt->an1_extras ) { - rec = (an1_waypoint_record *)(void *)(wpt->an1_extras); + if ( fs ) { + rec = (an1_waypoint_record *)fs; xfree( rec->name ); local = 0; } @@ -633,7 +639,7 @@ static void Read_AN1_Lines( FILE *f ) { Read_AN1_Line( f, rec ); /* create route rec */ rte_head = route_head_alloc(); - rte_head->an1_extras = (an1_base *)(void *)rec; + fs_chain_add( &rte_head->fs, (format_specific_data *)rec ); route_add_head(rte_head); for (j = 0; j < (unsigned) rec->pointcount; j++ ) { vert = Alloc_AN1_Vertex(); @@ -645,7 +651,8 @@ static void Read_AN1_Lines( FILE *f ) { wpt_tmp->longitude = -DecodeOrd( vert->lon ); wpt_tmp->shortname = (char *) xmalloc(7); sprintf( wpt_tmp->shortname, "\\%5.5x", rtserial++ ); - wpt_tmp->an1_extras = (an1_base *)(void *)vert; + fs_chain_add( &wpt_tmp->fs, + (format_specific_data *)vert ); route_add_wpt(rte_head, wpt_tmp); } } @@ -656,15 +663,18 @@ Write_One_AN1_Line( const route_head *rte ) { an1_line_record *rec; int local; + format_specific_data *fs = NULL; - if ( rte->an1_extras ) { - rec = (an1_line_record *)(void *)(rte->an1_extras); + fs = fs_chain_find( rte->fs, FS_AN1L ); + + if ( fs ) { + rec = (an1_line_record *)(void *)fs; local = 0; switch (output_type_num) { case 1: if ( rec->type != 14 ) { rec = Alloc_AN1_Line(); - memcpy( rec, rte->an1_extras, sizeof(an1_line_record)); + memcpy( rec, fs, sizeof(an1_line_record)); local = 1; rec->magic = 4112; rec->unk1 = 4359; @@ -676,7 +686,7 @@ Write_One_AN1_Line( const route_head *rte ) case 2: if ( rec->type != 15 ) { rec = Alloc_AN1_Line(); - memcpy( rec, rte->an1_extras, sizeof(an1_line_record)); + memcpy( rec, fs, sizeof(an1_line_record)); local = 1; rec->type = 15; } // end if @@ -684,7 +694,7 @@ Write_One_AN1_Line( const route_head *rte ) case 4: if ( rec->type != 16 ) { rec = Alloc_AN1_Line(); - memcpy( rec, rte->an1_extras, sizeof(an1_line_record)); + memcpy( rec, fs, sizeof(an1_line_record)); local = 1; rec->type = 16; } // end if @@ -752,9 +762,12 @@ Write_One_AN1_Vertex( const waypoint *wpt ) { an1_vertex_record *rec; int local; + format_specific_data *fs = NULL; + + fs = fs_chain_find( wpt->fs, FS_AN1V ); - if ( wpt->an1_extras ) { - rec = (an1_vertex_record *)(void *)(wpt->an1_extras); + if ( fs ) { + rec = (an1_vertex_record *)(void *)fs; local = 0; } else { diff --git a/defs.h b/defs.h index c7dfef4e4..a0b5eeb62 100644 --- a/defs.h +++ b/defs.h @@ -171,12 +171,32 @@ typedef struct xml_tag { struct xml_tag *child; } xml_tag ; -typedef void (*an1_destroy)(void *); -typedef void (*an1_copy)(void **, void *); -typedef struct { - an1_destroy destroy; - an1_copy copy; -} an1_base; +typedef void (*fs_destroy)(void *); +typedef void (*fs_copy)(void **, void *); +typedef struct format_specific_data { + long type; + struct format_specific_data *next; + + fs_destroy destroy; + fs_copy copy; +} format_specific_data; + +format_specific_data *fs_chain_copy( format_specific_data *source ); +void fs_chain_destroy( format_specific_data *chain ); +format_specific_data *fs_chain_find( format_specific_data *chain, long type ); +void fs_chain_add( format_specific_data **chain, format_specific_data *data ); + +typedef struct fs_xml { + format_specific_data fs; + xml_tag *tag; +} fs_xml; + +fs_xml *fs_xml_alloc( long type ); + +#define FS_GPX 0x67707800L +#define FS_AN1W 0x616e3177L +#define FS_AN1L 0x616e316cL +#define FS_AN1V 0x616e3176L /* * Misc bitfields inside struct waypoint; @@ -267,8 +287,7 @@ typedef struct { int sat; /* Optional: number of sats used for fix */ geocache_data gc_data; - xml_tag *gpx_extras; - an1_base *an1_extras; + format_specific_data *fs; void *extra_data; /* Extra data added by, say, a filter. */ } waypoint; @@ -279,7 +298,7 @@ typedef struct { char *rte_desc; int rte_num; int rte_waypt_ct; /* # waypoints in waypoint list */ - an1_base *an1_extras; + format_specific_data *fs; } route_head; /* diff --git a/formspec.c b/formspec.c new file mode 100644 index 000000000..1c20c53c9 --- /dev/null +++ b/formspec.c @@ -0,0 +1,65 @@ +/* + Functions to manage the format_specific_data chain + + Copyright (C) 2005 Ron Parker and Robert Lipe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include +#include +#include + +#include "defs.h" + +format_specific_data *fs_chain_copy( format_specific_data *source ) { + format_specific_data *result = NULL; + + format_specific_data **copy = &result; + while ( source ) { + source->copy( (void **)copy, (void *)source ); + copy = &((*copy)->next); + source = source->next; + } + return result; +} + +void fs_chain_destroy( format_specific_data *chain ) { + format_specific_data *cur = chain; + format_specific_data *next = NULL; + while ( cur ) { + next = cur->next; + cur->destroy( cur ); + cur = next; + } +} + +format_specific_data *fs_chain_find( format_specific_data *chain, long type ) { + format_specific_data *cur = chain; + while ( cur ) { + if (cur->type == type ) { + return cur; + } + cur = cur->next; + } + return NULL; +} + +void fs_chain_add( format_specific_data **chain, format_specific_data *data ) { + data->next = *chain; + *chain = data; +} + diff --git a/gpx.c b/gpx.c index 8374d927c..f11401bfd 100644 --- a/gpx.c +++ b/gpx.c @@ -58,6 +58,7 @@ static char *urlbase = NULL; static route_head *trk_head; static route_head *rte_head; + #define MYNAME "GPX" #define MY_CBUF 4096 #define DEFAULT_XSI_SCHEMA_LOC "http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" @@ -329,6 +330,7 @@ start_something_else(const char *el, const char **attrv) char **avcp = NULL; int attr_count = 0; xml_tag *new_tag; + fs_xml *fs_gpx = NULL; if ( !wpt_tmp ) { return; @@ -369,8 +371,10 @@ start_something_else(const char *el, const char **attrv) } } else { - if ( wpt_tmp->gpx_extras ) { - cur_tag = wpt_tmp->gpx_extras; + fs_gpx = (fs_xml *)fs_chain_find( wpt_tmp->fs, FS_GPX ); + + if ( fs_gpx && fs_gpx->tag ) { + cur_tag = fs_gpx->tag; while ( cur_tag->sibling ) { cur_tag = cur_tag->sibling; } @@ -378,7 +382,9 @@ start_something_else(const char *el, const char **attrv) new_tag->parent = NULL; } else { - wpt_tmp->gpx_extras = new_tag; + fs_gpx = fs_xml_alloc(FS_GPX); + fs_gpx->tag = new_tag; + fs_chain_add( &(wpt_tmp->fs), (format_specific_data *)fs_gpx ); new_tag->parent = NULL; } } @@ -1268,6 +1274,7 @@ gpx_waypt_pr(const waypoint *waypointp) { const char *oname; char *odesc; + fs_xml *fs_gpx = NULL; /* * Desparation time, try very hard to get a good shortname @@ -1292,7 +1299,10 @@ gpx_waypt_pr(const waypoint *waypointp) gpx_write_common_description(waypointp, " ", oname); gpx_write_common_acc(waypointp, " "); - fprint_xml_chain( waypointp->gpx_extras, waypointp ); + fs_gpx = (fs_xml *)fs_chain_find( waypointp->fs, FS_GPX ); + if ( fs_gpx ) { + fprint_xml_chain( fs_gpx->tag, waypointp ); + } fprintf(ofd, "\n"); } diff --git a/html.c b/html.c index ab72d1c49..7fc724705 100644 --- a/html.c +++ b/html.c @@ -69,6 +69,7 @@ html_disp(const waypoint *wpt) int32 utmz; double utme, utmn; char utmzc; + fs_xml *fs_gpx = NULL; lonint = abs((int) wpt->longitude); latint = abs((int) wpt->latitude); @@ -126,8 +127,14 @@ html_disp(const waypoint *wpt) else if (wpt->notes && (!wpt->description || strcmp(wpt->notes,wpt->description))) { fprintf (file_out, "

%s

\n", wpt->notes); } - if ( includelogs && wpt->gpx_extras ) { - xml_tag *root = wpt->gpx_extras; + + fs_gpx = NULL; + if ( includelogs ) { + fs_gpx = (fs_xml *)fs_chain_find( wpt->fs, FS_GPX); + } + + if ( fs_gpx && fs_gpx->tag ) { + xml_tag *root = fs_gpx->tag; xml_tag *curlog = NULL; xml_tag *logpart = NULL; curlog = xml_findfirst( root, "groundspeak:log" ); diff --git a/palmdoc.c b/palmdoc.c index 41585b77d..8a5054645 100644 --- a/palmdoc.c +++ b/palmdoc.c @@ -419,6 +419,7 @@ palmdoc_disp(const waypoint *wpt) double utme, utmn; char utmzc; char *bm; + fs_xml *fs_gpx = NULL; char bookmarktext[17]; @@ -482,9 +483,14 @@ palmdoc_disp(const waypoint *wpt) else if (wpt->notes && (!wpt->description || strcmp(wpt->notes,wpt->description))) { docprintf (10+strlen(wpt->notes), "%s\n", wpt->notes); } - - if ( includelogs && wpt->gpx_extras ) { - xml_tag *root = wpt->gpx_extras; + + fs_gpx = NULL; + if ( includelogs ) { + fs_gpx = (fs_xml *)fs_chain_find( wpt->fs, FS_GPX); + } + + if ( fs_gpx && fs_gpx->tag ) { + xml_tag *root = fs_gpx->tag; xml_tag *curlog = NULL; xml_tag *logpart = NULL; curlog = xml_findfirst( root, "groundspeak:log" ); diff --git a/route.c b/route.c index 750d13988..e1069f08d 100644 --- a/route.c +++ b/route.c @@ -128,10 +128,9 @@ route_free(route_head *rte) } rte_waypts -= rte->rte_waypt_ct; waypt_flush(&rte->waypoint_list); - if ( rte->an1_extras ) { - (*(rte->an1_extras->destroy))((void *)rte->an1_extras ); - xfree( rte->an1_extras ); - } + if ( rte->fs ) { + fs_chain_destroy( rte->fs ); + } xfree(rte); } diff --git a/text.c b/text.c index 56b272c76..2b96568d5 100644 --- a/text.c +++ b/text.c @@ -70,6 +70,7 @@ text_disp(const waypoint *wpt) int32 utmz; double utme, utmn; char utmzc; + fs_xml *fs_gpx; lonint = abs((int) wpt->longitude); latint = abs((int) wpt->latitude); @@ -117,8 +118,13 @@ text_disp(const waypoint *wpt) fprintf (file_out, "%s\n", wpt->notes); } - if ( includelogs && wpt->gpx_extras ) { - xml_tag *root = wpt->gpx_extras; + fs_gpx = NULL; + if ( includelogs ) { + fs_gpx = (fs_xml *)fs_chain_find( wpt->fs, FS_GPX); + } + + if ( fs_gpx && fs_gpx->tag ) { + xml_tag *root = fs_gpx->tag; xml_tag *curlog = NULL; xml_tag *logpart = NULL; curlog = xml_findfirst( root, "groundspeak:log" ); diff --git a/waypt.c b/waypt.c index 04d244b08..f86958e3a 100644 --- a/waypt.c +++ b/waypt.c @@ -75,11 +75,7 @@ waypt_dupe(const waypoint *wpt) * on the master Q. */ tmp->Q.next = tmp->Q.prev = NULL; - tmp->gpx_extras = NULL; - if ( wpt->an1_extras ) { - wpt->an1_extras->copy((void **)(&tmp->an1_extras), - (void *)wpt->an1_extras ); - } + tmp->fs = fs_chain_copy( wpt->fs ); return tmp; } @@ -281,9 +277,6 @@ waypt_free( waypoint *wpt ) if (wpt->icon_descr && wpt->wpt_flags.icon_descr_is_dynamic) { xfree((char *)(void *)wpt->icon_descr); } - if (wpt->gpx_extras) { - free_gpx_extras(wpt->gpx_extras); - } if (wpt->gc_data.desc_short.utfstring) { xfree(wpt->gc_data.desc_short.utfstring); } @@ -296,10 +289,7 @@ waypt_free( waypoint *wpt ) if (wpt->gc_data.hint) { xfree (wpt->gc_data.hint); } - if ( wpt->an1_extras ) { - (*(wpt->an1_extras->destroy))((void *)wpt->an1_extras ); - xfree( wpt->an1_extras ); - } + fs_chain_destroy( wpt->fs ); xfree(wpt); } diff --git a/xmltag.c b/xmltag.c new file mode 100644 index 000000000..3a453eb50 --- /dev/null +++ b/xmltag.c @@ -0,0 +1,126 @@ +/* + Functions to deal with xml_tags + + Copyright (C) 2005 Ron Parker and Robert Lipe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include +#include +#include + +#include "defs.h" + +void free_xml_tag( xml_tag *tag ) +{ + xml_tag *next = NULL; + char **ap; + + while ( tag ) { + if (tag->cdata) { + xfree(tag->cdata); + } + if (tag->child) { + free_gpx_extras(tag->child); + } + if (tag->parentcdata) { + xfree(tag->parentcdata); + } + if (tag->tagname) { + xfree(tag->tagname); + } + if (tag->attributes) { + ap = tag->attributes; + + while (*ap) + xfree(*ap++); + + xfree(tag->attributes); + } + + next = tag->sibling; + xfree(tag); + tag = next; + } +} + +void copy_xml_tag( xml_tag **copy, xml_tag *src, xml_tag *parent ) { + xml_tag *res = NULL; + char **ap = NULL; + char **ap2 = NULL; + int count = 0; + + res = xcalloc( 1, sizeof(xml_tag)); + *copy = res; + + memcpy( res, src, sizeof(xml_tag)); + res->tagname = xstrdup( src->tagname ); + res->cdata = xstrdup( src->cdata ); + res->parentcdata = xstrdup( src->parentcdata ); + if ( src->attributes ) { + ap = src->attributes; + while ( *ap ) { + count++; + ap++; + } + res->attributes = (char **)xcalloc( count+1, sizeof(char *)); + ap = src->attributes; + ap2 = res->attributes; + while (*ap) { + *ap2 = xstrdup(*ap); + ap++; + ap2++; + } + } + res->parent = parent; + copy_xml_tag( &(res->sibling), src->sibling, parent ); + copy_xml_tag( &(res->child), src->child, res ); +} + +fs_xml *fs_xml_alloc( long type ); + +void fs_xml_destroy( void *fs ) { + fs_xml *xml = (fs_xml *)fs; + if ( xml ) { + free_xml_tag( xml->tag ); + } + free( fs ); +} + +void fs_xml_copy( void **copy, void *source ) { + fs_xml *src = (fs_xml *)source; + if ( !source ) { + *copy = NULL; + return; + } + *copy = (void *)fs_xml_alloc( src->fs.type ); + memcpy( *copy, source, sizeof(fs_xml) ); + copy_xml_tag( &(((fs_xml *)(*copy))->tag), src->tag, NULL ); +} + + +fs_xml *fs_xml_alloc( long type ) { + fs_xml *result = NULL; + + result = (fs_xml *)xcalloc( 1, sizeof(fs_xml)); + result->fs.type = type; + result->fs.copy = fs_xml_copy; + result->fs.destroy = fs_xml_destroy; + return result; +} + + -- 2.30.2